package com.unusap.remote.core.register.dto;

import java.util.Collection;
import java.util.HashSet;

import com.unusap.remote.core.dto.AbstractRequest;
import com.unusap.remote.core.dto.SP;
import com.unusap.remote.core.dto.ValueEntry;
import com.unusap.remote.core.util.ValueEntryUtils;

/**
 * 
 * 
 * @author danson
 * RegisterValidateRequest.java
 * 2009-8-19
 */
public class RegisterValidateRequest extends AbstractRequest {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8515378256652567737L;
	
	/**
	 * 校验请求发起方(可能不同的发起方的校验请求不一样)
	 */
	private SP requestSP;

	/**
	 * validateEntry的name由调用方确定
	 */
	private Collection<ValueEntry> validateEntries = new HashSet<ValueEntry>();

	public SP getRequestSP() {
		return requestSP;
	}

	public RegisterValidateRequest setRequestSP(SP requestSP) {
		this.requestSP = requestSP;
		return this;
	}

	public Collection<ValueEntry> getValidateEntries() {
		return validateEntries;
	}

	public RegisterValidateRequest setValidateEntries(Collection<ValueEntry> validateEntries) {
		this.validateEntries = validateEntries;
		return this;
	}
	
	public RegisterValidateRequest addValidateEntry(ValueEntry validateEntry) {
		this.validateEntries.add(validateEntry);
		return this;
	}

    public ValueEntry getValidEntry(String name) {
        return ValueEntryUtils.getValueEntry(validateEntries, name);
    }

}
